Skip to content

Conversation

mcruzdev
Copy link
Contributor

Description

This pull request aims to align the Java SDK Workflow API woth other languages (Python, C#, etc.)

What this pull request does:

  • Deprecate waitForInstanceStart, getInstanceState and waitForInstanceCompletion.
  • Change the documentation to use the new methods (waitForWorkflowStart, getWorkflowState and waitForWorkflowCompletion)
  • Change test to use the new methods.

Issue reference

Closes #1554

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@siri-varma
Copy link
Contributor

@mcruzdev The patch coverage is failing. Looks like some more unit tests are needed.

@siri-varma
Copy link
Contributor

LGTM. Can be merged once the patch succeedes

artur-ciocanu

This comment was marked as duplicate.

Copy link
Contributor

@artur-ciocanu artur-ciocanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcruzdev thanks a lot for looking into this.

I would like to request changes and suggest some improvements:

  • There is another method in the DaprWorkflowClient which uses instance purgeInstance I think it should be renamed to purgeWorkflow to stay consistent with other API changes.
  • We should add a new interface named WorkflowState that should be similar to WorkflowInstanceStatus and we should ensure that instead of getInstanceId we use getWorkflowId
  • Once you have the new interface you should adjust the implementation to ensure that the new methods use the new interface.
  • You will also have to add an implementation similar to DefaultWorkflowInstanceStatus but for WorkflowState something like DefaultWorkflowState.
  • One more thing I think we should adjust Java Docs to use workflowId instead of instanceId so we have a more clean API description.

I know it is a little bit more work, but I think it is totally worth it if we want to align with other SDKs.

Thank you 🙇

CC: @salaboy @cicoyle

@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 2, 2025

Hi @artur-ciocanu, I applied all requested changes, let me know if we have something wrong :)

artur-ciocanu
artur-ciocanu previously approved these changes Oct 3, 2025
Copy link
Contributor

@artur-ciocanu artur-ciocanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcruzdev love it ❤️ ! I have left a tiny comment related to docs. You should make sure that those are aligned with your changes.

Also we need to make sure the build is 🟢.

@artur-ciocanu
Copy link
Contributor

@mcruzdev could you please check the test you added. I see these details in the build logs:

05:40:09.322 [main] INFO  i.d.i.t.workflows.DaprWorkflowsIIT - Starting DaprWorkflowsIIT using Java 17.0.16 with PID 19986 (started by runner in /home/runner/work/java-sdk/java-sdk/sdk-tests)

And then we have a long list of these:

time="2025-10-03T05:40:09.623842519Z" level=debug msg="Error for operation DaprBuiltInActorNotFoundRetries was: failed to lookup actor: api error: code = FailedPrecondition desc = did not find address for actor" app_id=workflow-dapr-app instance=7def0498f830 scope=dapr.runtime type=log ver=1.16.0-rc.5

05:40:14.099 [Thread-443] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-441] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-442] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-444] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.619 [Thread-462] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
time="2025-10-03T05:40:15.627565918Z" level=warning msg="Error processing operation DaprBuiltInActorNotFoundRetries. Retrying in 1s…" app_id=workflow-dapr-app instance=7def0498f830 scope=dapr.runtime type=log ver=1.16.0-rc.5

And eventually the task timeouts.

@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 4, 2025

Yes, checking today

@mcruzdev
Copy link
Contributor Author

mcruzdev commented Oct 4, 2025

@mcruzdev could you please check the test you added. I see these details in the build logs:

05:40:09.322 [main] INFO  i.d.i.t.workflows.DaprWorkflowsIIT - Starting DaprWorkflowsIIT using Java 17.0.16 with PID 19986 (started by runner in /home/runner/work/java-sdk/java-sdk/sdk-tests)

And then we have a long list of these:

time="2025-10-03T05:40:09.623842519Z" level=debug msg="Error for operation DaprBuiltInActorNotFoundRetries was: failed to lookup actor: api error: code = FailedPrecondition desc = did not find address for actor" app_id=workflow-dapr-app instance=7def0498f830 scope=dapr.runtime type=log ver=1.16.0-rc.5

05:40:14.099 [Thread-443] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-441] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-442] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.099 [Thread-444] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
05:40:14.619 [Thread-462] INFO  io.dapr.durabletask - The sidecar at address 127.0.0.1:32941 is unavailable. Will continue retrying.
time="2025-10-03T05:40:15.627565918Z" level=warning msg="Error processing operation DaprBuiltInActorNotFoundRetries. Retrying in 1s…" app_id=workflow-dapr-app instance=7def0498f830 scope=dapr.runtime type=log ver=1.16.0-rc.5

And eventually the task timeouts.

I need to investigate, I just copied the old test using the new API naming.

@artur-ciocanu
Copy link
Contributor

@mcruzdev I was wondering if you have any updates. Thank you.

@mcruzdev
Copy link
Contributor Author

Hi @artur-ciocanu, apologies if I missed something. Could you please clarify what’s needed to move this pull request forward?

@artur-ciocanu
Copy link
Contributor

@mcruzdev there are two checks that are failing, one for Spring Boot 3.4 and the other one for Spring Boot 3.5.

As far as I can tell the build for both of these is timing out after 30 mins.

The build logs says that DurableTask is trying to connect to Dapr sidecar and that is unavailable on a particular port.

Could you please take a look and let me know if you need any help.

Thank you.

@mcruzdev mcruzdev force-pushed the issue-1554 branch 3 times, most recently from 3db364c to 9241389 Compare October 19, 2025 20:49
@artur-ciocanu
Copy link
Contributor

@mcruzdev could you please resolve the conflicts and it should be good to merge.

Thank you

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Copy link
Contributor

@artur-ciocanu artur-ciocanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcruzdev great job! Thanks a lot for all the effort!

@artur-ciocanu
Copy link
Contributor

@dapr/approvers-java-sdk could you please approve. Thank you!

@dapr-bot dapr-bot merged commit 81e1279 into dapr:master Oct 20, 2025
10 checks passed
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.44%. Comparing base (d759c53) to head (084ca34).
⚠️ Report is 230 commits behind head on master.

Files with missing lines Patch % Lines
...a/io/dapr/workflows/client/DaprWorkflowClient.java 50.00% 1 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1560      +/-   ##
============================================
+ Coverage     76.91%   78.44%   +1.53%     
- Complexity     1592     1929     +337     
============================================
  Files           145      216      +71     
  Lines          4843     5860    +1017     
  Branches        562      656      +94     
============================================
+ Hits           3725     4597     +872     
- Misses          821      926     +105     
- Partials        297      337      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcruzdev mcruzdev deleted the issue-1554 branch October 20, 2025 13:54
salaboy pushed a commit to salaboy/java-sdk that referenced this pull request Oct 21, 2025
* Align Java API with other languages

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Update documentation

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Change return type of waitForWorkflowStart method

Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>

---------

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
salaboy pushed a commit to salaboy/java-sdk that referenced this pull request Oct 21, 2025
* Align Java API with other languages

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Update documentation

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Change return type of waitForWorkflowStart method

Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>

---------

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
salaboy pushed a commit to salaboy/java-sdk that referenced this pull request Oct 21, 2025
* Align Java API with other languages

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Update documentation

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Change return type of waitForWorkflowStart method

Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>

---------

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
salaboy pushed a commit to salaboy/java-sdk that referenced this pull request Oct 21, 2025
* Align Java API with other languages

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Update documentation

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Change return type of waitForWorkflowStart method

Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>

---------

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
salaboy pushed a commit to salaboy/java-sdk that referenced this pull request Oct 21, 2025
* Align Java API with other languages

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Update documentation

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>

* Change return type of waitForWorkflowStart method

Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>

---------

Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
Signed-off-by: artur-ciocanu <artur.ciocanu@gmail.com>
Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com>
Signed-off-by: salaboy <Salaboy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align getInstanceState and other instance-based APIs with workflow naming

4 participants